package com.igeek;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/login")
public class LoginServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //接收用户名
        String usernmae = request.getParameter("username");
        System.out.println("username:"+usernmae);
        //返回用户名
        response.getWriter().write(usernmae);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //接收用户名
        String usernmae = req.getParameter("username");
        System.out.println("username:"+usernmae);
        //返回用户名
        resp.getWriter().write(usernmae);
    }
}
